<?php
error_reporting( E_ALL );

include ( '../dynamic/_libs/classes/path.php' );

$testCases = array
(
	'test/example.com/document.txt'
	, 'test/example.com/readme'
	, 'test/example.com/'
	, 'test/example.com'
	, 'test/example'
	, 'xxx'
);

foreach ( $testCases as $v )
{
	$testCases[] = str_replace( 'test/', 'non-exist/', $v );
}

print '<pre>';
$base = dirname( __FILE__ );
print 'base: '.$base.'<br />';
foreach ( $testCases as $test )
{
	$path = new Path( $test, $base );
	
	print '--------------<br />Test case for: "<strong>'.$test.'</strong><br /><br />';
	print 'normalized(): "'.$path->normalized().'" ( guessed: "'.$path->guess->normalized().'" )</br>';
	print 'absolute(): "'.$path->absolute().'"</br>';
	print 'exists(): "'.(int)$path->exists().'" ( guessed: "'.$path->guess->exists().'" )</br>';
	print 'homeDir(): "'.$path->homeDir().'"</br>';
	print 'basename(): "'.$path->basename().'" ( guessed: "'.$path->guess->basename().'" )</br>';
	print 'extension(): "'.$path->extension().'" ( guessed: "'.$path->guess->extension().'" )</br>';
	print 'merge(/fakeroot/fakehome/): "'.$path->merge('/fakeroot/fakehome/').'"</br>';
	print 'diff(test/): "'.$path->diff( 'test/' ).'"</br>';
	print 'isInside('.$base.'):"'.(int)$path->isInside( $base ).'"</br>';
	print 'isInside('.'test/example.com/'.'):"'.(int)$path->isInside( 'test/example.com/' ).'"</br>';
	print 'isInside('.'non-exist/example.com/'.'):"'.(int)$path->isInside( 'non-exist/example.com/' ).'"</br>';
	print '<br />';
}
print '</pre>';
?>